home *** CD-ROM | disk | FTP | other *** search
- on report outString
- global testData
- exit
- if objectp(testData) then
- testData(mWriteString, outString & RETURN)
- else
- put outString
- end if
- end
-
- on REPORT2 outString
- global testData
- exit
- if objectp(testData) then
- testData(mWriteString, outString & RETURN)
- else
- put outString
- end if
- end
-
- on preloadLocations
- global oPuppeteer
- set the preLoadEventAbort to 0
- set thisLoc to getState(oStoryteller, #currentLocation)
- set loadList to getProp(getLocationPointer(oPuppeteer, thisLoc), #preLoad)
- set loadSize to 0
- repeat with myNumber in loadList
- if the loaded of cast myNumber = 0 then
- preLoadCast(myNumber)
- set loadSize to loadSize + the size of cast myNumber
- end if
- end repeat
- end
-
- on wait howLong, whichSound
- global oStoryteller
- if howLong = #videoStop then
- repeat while the movieRate of sprite 44 > 0
- updateStage()
- end repeat
- exit
- end if
- if howLong = #soundStop then
- set theChannel to #none
- set soundChannels to getProp(the lsStateData of oStoryteller, #soundChannels)
- repeat with i = 1 to count(soundChannels)
- set channelData to getAt(soundChannels, i)
- if getProp(channelData, #sndName) = whichSound then
- set theChannel to getPropAt(soundChannels, i)
- end if
- end repeat
- if theChannel <> #none then
- repeat while soundBusy(theChannel)
- updateStage()
- end repeat
- end if
- exit
- end if
- if integerp(howLong) then
- startTimer()
- repeat while the timer < howLong
- updateStage()
- end repeat
- end if
- end
-
- on initMultiFrames
- global oStoryteller, oPuppeteer
- exit
- set frameStack to getProp(the lsMultiFrames of oPuppeteer, #levelDigits)
- set firstFrame to getAt(frameStack, getState(oStoryteller, #BarLevel) + 2)
- set the palette of cast "BAR-FM.frame" to the palette of cast firstFrame
- puppetPalette(the palette of cast firstFrame)
- updateStage()
- set the picture of cast getAt(frameStack, 1) to the picture of cast firstFrame
- set frameStack to getProp(the lsMultiFrames of oPuppeteer, #gainDigits)
- set firstFrame to getAt(frameStack, getState(oStoryteller, #BarGain) + 2)
- set the palette of cast "BAR-FM.frame" to the palette of cast firstFrame
- put "'gain' palette is " & the palette of cast "BAR-FM.frame"
- puppetPalette(the palette of cast firstFrame)
- updateStage()
- set the picture of cast getAt(frameStack, 1) to the picture of cast firstFrame
- set frameStack to getProp(the lsMultiFrames of oPuppeteer, #FMdigits)
- set firstFrame to getAt(frameStack, getState(oStoryteller, #BarFM) + 2)
- puppetPalette(the palette of cast firstFrame)
- updateStage()
- set the picture of cast getAt(frameStack, 1) to the picture of cast firstFrame
- end
-
- on initInventory
- global oStoryteller, oPuppeteer, gOriginPoint
- set the lsInventory of oPuppeteer to [#none, #none, #none, #none, #none, #none, #none]
- if getState(oStoryteller, #itemInUse) <> #Headgear then
- setState(oStoryteller, #itemInUse, #none)
- end if
- if getState(oStoryteller, #inventoryStatus) = #cool then
- freezeInventory()
- else
- unFreezeInventory()
- end if
- repeat with i = 1 to count(the lsInventoryData of oPuppeteer)
- set candidate to getPropAt(the lsInventoryData of oPuppeteer, i)
- set itemState to getState(oStoryteller, value("#playerHas" & candidate))
- if (itemState <> 0) and (itemState <> #usedUp) then
- if (candidate = #Headgear) and (getState(oStoryteller, #playerHasHeadgear) = #inUse) then
- puppetSprite(39, 1)
- if getState(oStoryteller, #houseLightsAreOn) = 1 then
- set hgCast to getProp(the lsForegroundData of oPuppeteer, #Headgear)
- else
- set hgCast to getProp(the lsForegroundData of oPuppeteer, #HeadgearOff)
- end if
- set the castNum of sprite 39 to hgCast
- set the loc of sprite 39 to point(320, 129) + gOriginPoint
- set the ink of sprite 39 to 8
- setState(oStoryteller, value("#playerHas" & candidate), itemState)
- else
- addInventory(candidate, #quietly)
- setState(oStoryteller, value("#playerHas" & candidate), #carrying)
- end if
- next repeat
- end if
- end repeat
- cursorOff()
- fadeOutTransit()
- moveToLocation(oPuppeteer)
- setTransition(oPuppeteer, #fadeIn)
- updateDisplay(oPuppeteer)
- if getState(oStoryteller, #currentLocation) = #DarkUp_40sReentry then
- fadeOutTransit()
- trimState(#ghostsRemaining, #Margaret)
- ghostCalls(#none)
- trimState(#hauntsRemaining, #ghostBrushingHair)
- trimState(#hauntsRemaining, #stairsGhost)
- setLoop(#houseHum, 96)
- setState(oStoryteller, #showMontage, 1)
- setTransition(oPuppeteer, #slowMontage)
- updateDisplay(oPuppeteer)
- setState(oStoryteller, #PeekDisplay, #psionicFragment)
- peekAlert()
- end if
- if getState(oStoryteller, #currentLocation) = #Ggaz_Reentry then
- fadeOutTransit()
- trimState(#ghostsRemaining, #Brice)
- ghostCalls(#none)
- trimState(#hauntsRemaining, #knifeShadow)
- trimState(#hauntsRemaining, #hungMan)
- trimState(#hauntsRemaining, #TVghost)
- trimState(#hauntsRemaining, #gazebo1)
- trimState(#hauntsRemaining, #gazebo2)
- trimState(#hauntsRemaining, #gazebo3)
- setState(oStoryteller, #showMontage, 1)
- setTransition(oPuppeteer, #slowMontage)
- updateDisplay(oPuppeteer)
- setState(oStoryteller, #PeekDisplay, #psionicFragment)
- peekAlert()
- end if
- if getState(oStoryteller, #currentLocation) = #Gbhs_Reentry1 then
- fadeOutTransit()
- trimState(#ghostsRemaining, #Edwin)
- ghostCalls(#none)
- trimState(#hauntsRemaining, #lakeGhost)
- trimState(#hauntsRemaining, #lakeGhost2)
- setState(oStoryteller, #showMontage, 1)
- setTransition(oPuppeteer, #slowMontage)
- updateDisplay(oPuppeteer)
- setState(oStoryteller, #PeekDisplay, #psionicFragment)
- peekAlert()
- end if
- if getState(oStoryteller, #currentLocation) = #Gbhs_playIntro then
- pushVideo()
- repeat while (the movieRate of sprite 44 <> 0) and not (the mouseDown)
- updateStage()
- end repeat
- killVideo()
- goTo(#Gbhs_GameEntry, #fadeIn)
- end if
- end
-
- on addInventory whichItem, optionalSwitch
- global oPuppeteer, gOriginPoint
- set inventoryList to the lsInventory of oPuppeteer
- if the paramCount < 1 then
- put "Hey, you can't call addInventory without an argument.."
- exit
- end if
- if voidp(getaProp(the lsInventoryData of oPuppeteer, whichItem)) then
- put "Hey, there's no such thing in this inventory..."
- exit
- end if
- if getPos(inventoryList, whichItem) then
- put "Hey, " & whichItem & " is already in inventory..."
- exit
- end if
- if whichItem = #Headgear then
- set the loc of sprite 39 to point(-1000, -1000) + gOriginPoint
- puppetSprite(39, 0)
- end if
- setState(oStoryteller, value("#playerHas" & whichItem), #carrying)
- if getAt(inventoryList, 4) = #none then
- setAt(inventoryList, 4, whichItem)
- else
- set leftSlotsOpen to 0
- set rightSlotsOpen to 0
- repeat with i = 1 to 3
- if getAt(inventoryList, i) <> #none then
- exit repeat
- end if
- set leftSlotsOpen to leftSlotsOpen + 1
- end repeat
- repeat with i = 7 down to 5
- if getAt(inventoryList, i) <> #none then
- exit repeat
- end if
- set rightSlotsOpen to rightSlotsOpen + 1
- end repeat
- if whichItem = #PeekUnit then
- if (getAt(inventoryList, 4) = #ScanDevice) or (getAt(inventoryList, 4) = #Headgear) then
- if getAt(inventoryList, 4) = #ScanDevice then
- if leftSlotsOpen then
- deleteAt(inventoryList, 1)
- addAt(inventoryList, 4, whichItem)
- else
- deleteAt(inventoryList, 7)
- addAt(inventoryList, 4, whichItem)
- end if
- else
- if rightSlotsOpen then
- deleteAt(inventoryList, 7)
- addAt(inventoryList, 4, whichItem)
- else
- deleteAt(inventoryList, 1)
- addAt(inventoryList, 4, whichItem)
- end if
- end if
- else
- set whichSide to #right
- if leftSlotsOpen > rightSlotsOpen then
- set whichSide to #left
- end if
- if whichSide = #left then
- deleteAt(inventoryList, 1)
- else
- deleteAt(inventoryList, 7)
- end if
- addAt(inventoryList, 4, whichItem)
- end if
- else
- if whichItem = #ScanDevice then
- if leftSlotsOpen < 1 then
- deleteAt(inventoryList, 7)
- addAt(inventoryList, 8 - rightSlotsOpen, whichItem)
- else
- deleteAt(inventoryList, 1)
- addAt(inventoryList, 0 + leftSlotsOpen, whichItem)
- end if
- else
- if whichItem = #Headgear then
- if rightSlotsOpen < 1 then
- deleteAt(inventoryList, 1)
- addAt(inventoryList, 0 + leftSlotsOpen, whichItem)
- else
- deleteAt(inventoryList, 7)
- addAt(inventoryList, 8 - rightSlotsOpen, whichItem)
- end if
- else
- set whichSide to #right
- if leftSlotsOpen > rightSlotsOpen then
- set whichSide to #left
- end if
- if whichSide = #left then
- deleteAt(inventoryList, 1)
- addAt(inventoryList, 0 + leftSlotsOpen, whichItem)
- else
- deleteAt(inventoryList, 7)
- addAt(inventoryList, 8 - rightSlotsOpen, whichItem)
- end if
- end if
- end if
- end if
- end if
- updateInventory()
- if optionalSwitch <> #quietly then
- setTransition(oPuppeteer, #fadeIn)
- updateDisplay(oPuppeteer)
- glimpseInventory(whichItem)
- end if
- end
-
- on deleteInventory whichItem
- global oPuppeteer, oStoryteller
- set inventoryList to the lsInventory of oPuppeteer
- if the paramCount < 1 then
- put "Hey, you can't call deleteInventory without an argument.."
- exit
- end if
- set itsPosition to getPos(inventoryList, whichItem)
- if not itsPosition then
- put "The item " & whichItem & " isn't IN inventory; can't delete.."
- exit
- end if
- if (whichItem = #ScanDevice) or (whichItem = #Headgear) then
- if whichItem = #ScanDevice then
- setState(oStoryteller, value("#playerHas" & whichItem), 0)
- end if
- if whichItem = #Headgear then
- setState(oStoryteller, value("#playerHas" & whichItem), #inUse)
- end if
- else
- setState(oStoryteller, value("#playerHas" & whichItem), #usedUp)
- end if
- if getState(oStoryteller, #itemInUse) = whichItem then
- setState(oStoryteller, #itemInUse, #none)
- end if
- if itsPosition < 4 then
- deleteAt(inventoryList, itsPosition)
- addAt(inventoryList, 1, #none)
- else
- if itsPosition > 4 then
- deleteAt(inventoryList, itsPosition)
- addAt(inventoryList, 7, #none)
- else
- set leftSlotsOpen to 0
- set rightSlotsOpen to 0
- repeat with i = 1 to 3
- if getAt(inventoryList, i) <> #none then
- exit repeat
- end if
- set leftSlotsOpen to leftSlotsOpen + 1
- end repeat
- repeat with i = 7 down to 5
- if getAt(inventoryList, i) <> #none then
- exit repeat
- end if
- set rightSlotsOpen to rightSlotsOpen + 1
- end repeat
- set whichSide to #right
- if leftSlotsOpen > rightSlotsOpen then
- set whichSide to #left
- end if
- if whichSide = #left then
- addAt(inventoryList, 7, #none)
- deleteAt(inventoryList, 4)
- else
- deleteAt(inventoryList, 4)
- addAt(inventoryList, 1, #none)
- end if
- end if
- end if
- updateInventory()
- setTransition(oPuppeteer, #fadeIn)
- updateDisplay(oPuppeteer)
- end
-
- on useInventory whichItem
- global oPuppeteer, oStoryteller, thisCursor, lastCursor, gOriginPoint
- set negateList to [#playerIsReadingNoteInStudy, #playerIsExaminingHeadgear, #playerIsExaminingOscillator, #playerIsExaminingWeedkiller, #playerIsExaminingVideotape, #playerIsReadingDreamDiary, #playerIsExaminingDreamDiary, #playerIsReadingBarManual, #playerIsExaminingBarManual, #playerIsExaminingPhone, #playerIsReadingRealms, #playerIsExaminingRealms, #playerIsExaminingPyramid, #playerIsExaminingHypnoFlier]
- if whichItem = #PeekUnit then
- if getState(oStoryteller, #itemInUse) = #PeekUnit then
- exit
- end if
- end if
- set mustFade to 0
- repeat with i in negateList
- if getState(oStoryteller, i) = 1 then
- set mustFade to 1
- setState(oStoryteller, i, 0)
- end if
- end repeat
- if mustFade then
- setTransition(oPuppeteer, #fadeIn)
- updateDisplay(oPuppeteer)
- end if
- if getState(oStoryteller, #itemInUse) = #PeekUnit then
- stowInventory(#PeekUnit)
- end if
- setState(oStoryteller, #itemInUse, whichItem)
- repeat with i in the lsInventory of oPuppeteer
- if i <> #none then
- if i = whichItem then
- setState(oStoryteller, value("#playerHas" & i), #inUse)
- next repeat
- end if
- if not ((i = #Headgear) and (getState(oStoryteller, #endGame) = 0)) then
- setState(oStoryteller, value("#playerHas" & i), #carrying)
- end if
- end if
- end repeat
- if whichItem = #Headgear then
- if getState(oStoryteller, #endGame) = 1 then
- setState(oStoryteller, #playerHasHeadgear, #endGame)
- setState(oStoryteller, #itemInUse, #Headgear)
- else
- setState(oStoryteller, #itemInUse, #none)
- deleteInventory(#Headgear)
- setState(oStoryteller, #playerHasHeadgear, #inUse)
- puppetSprite(39, 1)
- set hgCast to getProp(the lsForegroundData of oPuppeteer, #HeadgearOff)
- set the castNum of sprite 39 to hgCast
- set the loc of sprite 39 to point(320, 129) + gOriginPoint
- set the ink of sprite 39 to 8
- setTransition(oPuppeteer, #fadeIn)
- end if
- end if
- updateInventory()
- if whichItem = #PeekUnit then
- usePeekUnit()
- end if
- updateDisplay(oPuppeteer)
- if (whichItem = #Headgear) and getState(oStoryteller, #houseLightsAreOn) and (getState(oStoryteller, #endGame) = 0) then
- wait(10)
- set the castNum of sprite 39 to getProp(the lsForegroundData of oPuppeteer, #Headgear)
- updateStage()
- wait(5)
- if getState(oStoryteller, #houseLightsAreOn) then
- setState(oStoryteller, #AMBERVISION, #on)
- end if
- setLoop(#amberHum)
- end if
- updateDisplay(oPuppeteer)
- end
-
- on stowInventory whichItem
- global oPuppeteer, oStoryteller, gOriginPoint, gCPU
- setState(oStoryteller, #itemInUse, #none)
- setState(oStoryteller, value("#playerHas" & whichItem), #carrying)
- if whichItem = #PeekUnit then
- killVideo()
- set peekBody to 38
- set peekAntenna to 46
- set peekText to 40
- set pkScanIcon to 41
- set pkBarIcon to 42
- set pkAmberIcon to 43
- set the loc of sprite peekBody to point(-500, -500)
- set the loc of sprite peekAntenna to point(-500, -500)
- set the loc of sprite peekText to point(-500, -500)
- set the loc of sprite pkScanIcon to point(-500, -500)
- set the loc of sprite pkBarIcon to point(-500, -500)
- set the loc of sprite pkAmberIcon to point(-500, -500)
- puppetSprite(peekBody, 0)
- puppetSprite(peekAntenna, 0)
- puppetSprite(peekText, 0)
- puppetSprite(pkScanIcon, 0)
- puppetSprite(pkBarIcon, 0)
- puppetSprite(pkAmberIcon, 0)
- updateInventory()
- do("puppetTransition " & getProp(getProp(the lsMachineProfile of oPuppeteer, #transitions), #fadeIn))
- updateDisplay(oPuppeteer)
- if gCPU = #PC then
- restoreSounds(#fadeIn)
- end if
- testForPsionicWaves()
- if getPos(the lsInventory of oPuppeteer, #PeekUnit) then
- glimpseInventory(whichItem)
- else
- addInventory(#PeekUnit)
- end if
- if getState(oStoryteller, #AMBERVISION) = #startingUp then
- goTo(#StudyAmberMid, #backOff)
- pushVideo()
- wait(#videoStop)
- set the castNum of sprite 39 to getProp(the lsForegroundData of oPuppeteer, #Headgear)
- setState(oStoryteller, #AMBERVISION, #on)
- setLoop(#amberHum)
- end if
- else
- if whichItem = #Headgear then
- set the loc of sprite 39 to point(-1000, -1000) + gOriginPoint
- puppetSprite(39, 0)
- end if
- if whichItem = #WeedKiller then
- soundEffect(#WeedKiller)
- end if
- if getPos(the lsInventory of oPuppeteer, whichItem) then
- updateInventory()
- setTransition(oPuppeteer, #fadeIn)
- updateDisplay(oPuppeteer)
- glimpseInventory(whichItem)
- else
- addInventory(whichItem)
- end if
- end if
- end
-
- on glimpseInventory whichItem
- global oPuppeteer, gOriginPoint
- set foundationSprite to 3
- set itemV to 410
- set myPosition to getPos(the lsInventory of oPuppeteer, whichItem)
- set itemH to 40 + (70 * myPosition)
- set whichSprite to myPosition + foundationSprite
- if whichSprite > foundationSprite then
- cursorOff()
- puppetSprite(whichSprite, 1)
- set the castNum of sprite whichSprite to getAt(getProp(the lsInventoryData of oPuppeteer, whichItem), 1)
- set the loc of sprite whichSprite to point(itemH, itemV) + gOriginPoint
- updateStage()
- if the inventoryStatus of oPuppeteer = #cool then
- wait(25)
- set the castNum of sprite whichSprite to getAt(getProp(the lsInventoryData of oPuppeteer, whichItem), 2)
- do("puppetTransition " & getProp(getProp(the lsMachineProfile of oPuppeteer, #transitions), #fadeIn))
- updateStage()
- end if
- end if
- end
-